Max Flow
   HOME

TheInfoList



OR:

In
optimization theory Mathematical optimization (alternatively spelled ''optimisation'') or mathematical programming is the selection of a best element, with regard to some criterion, from some set of available alternatives. It is generally divided into two subfi ...
, maximum flow problems involve finding a feasible flow through a
flow network In graph theory, a flow network (also known as a transportation network) is a directed graph where each edge has a capacity and each edge receives a flow. The amount of flow on an edge cannot exceed the capacity of the edge. Often in operations res ...
that obtains the maximum possible flow rate. The maximum flow problem can be seen as a special case of more complex network flow problems, such as the
circulation problem The circulation problem and its variants are a generalisation of network flow problems, with the added constraint of a lower bound on edge flows, and with flow conservation also being required for the source and sink (i.e. there are no special node ...
. The maximum value of an s-t flow (i.e., flow from
source Source may refer to: Research * Historical document * Historical source * Source (intelligence) or sub source, typically a confidential provider of non open-source intelligence * Source (journalism), a person, publication, publishing institute o ...
s to
sink A sink is a bowl-shaped plumbing fixture for washing hands, dishwashing, and other purposes. Sinks have a tap (faucet) that supply hot and cold water and may include a spray feature to be used for faster rinsing. They also include a drain to ...
t) is equal to the minimum capacity of an s-t cut (i.e., cut severing s from t) in the network, as stated in the
max-flow min-cut theorem In computer science and optimization theory, the max-flow min-cut theorem states that in a flow network, the maximum amount of flow passing from the ''source'' to the ''sink'' is equal to the total weight of the edges in a minimum cut, i.e., the ...
.


History

The maximum flow problem was first formulated in 1954 by T. E. Harris and F. S. Ross as a simplified model of Soviet railway traffic flow. In 1955, Lester R. Ford, Jr. and Delbert R. Fulkerson created the first known algorithm, the Ford–Fulkerson algorithm.Ford, L.R., Jr.; Fulkerson, D.R., ''Flows in Networks'', Princeton University Press (1962). In their 1955 paper, Ford and Fulkerson wrote that the problem of Harris and Ross is formulated as follows (see p. 5):
Consider a rail network connecting two cities by way of a number of intermediate cities, where each link of the network has a number assigned to it representing its capacity. Assuming a steady state condition, find a maximal flow from one given city to the other.
In their book ''Flows in Network'', in 1962, Ford and Fulkerson wrote:
It was posed to the authors in the spring of 1955 by T. E. Harris, who, in conjunction with General F. S. Ross (Ret.), had formulated a simplified model of railway traffic flow, and pinpointed this particular problem as the central one suggested by the model 1
where 1refers to the 1955 secret report ''Fundamentals of a Method for Evaluating Rail net Capacities'' by Harris and Ross (see p. 5). Over the years, various improved solutions to the maximum flow problem were discovered, notably the shortest augmenting path algorithm of Edmonds and Karp and independently Dinitz; the blocking flow algorithm of Dinitz; the push-relabel algorithm of
Goldberg Goldberg or Goldberger may refer to: Arts and entertainment * Goldberg Ensemble, a British string ensemble * ''Goldberg Variations'', a set of 30 keyboard variations by Johann Sebastian Bach * ''The Goldbergs (broadcast series)'', American radio ...
and Tarjan; and the binary blocking flow algorithm of Goldberg and Rao. The algorithms of Sherman and Kelner, Lee, Orecchia and Sidford, respectively, find an approximately optimal maximum flow but only work in undirected graphs. In 2013 James B. Orlin published a paper describing an O(, V, , E, ) algorithm. In 2022 Li Chen, Rasmus Kyng, Yang P. Liu, Richard Peng, Maximilian Probst Gutenberg, and Sushant Sachdeva published an almost-linear time algorithm running in O(, E, ^).


Definition

First we establish some notation: * Let N = (V, E) be a network with s, t \in V being the source and the sink of N respectively. * If g is function on the edges of N then its value on (u,v) \in E is denoted by g_ or g(u,v). Definition. The capacity of an edge is the maximum amount of flow that can pass through an edge. Formally it is a map c: E \to \R^+. Definition. A flow is a map f : E \to \R that satisfies the following: *''Capacity constraint''. The flow of an edge cannot exceed its capacity, in other words: f_ \leq c_ for all (u, v) \in E. * ''Conservation of flows.'' The sum of the flows entering a node must equal the sum of the flows exiting that node, except for the source and the sink. Or: ::\forall v \in V \setminus \: \quad \sum_ f_ = \sum_ f_. ''Remark''. Flows are skew symmetric: f_ = -f_ for all (u, v) \in E. Definition. The value of flow is the amount of flow passing from the source to the sink. Formally for a flow f : E \to \R^+ it is given by: :, f, = \sum_ f_. Definition. The maximum flow problem is to route as much flow as possible from the source to the sink, in other words find the flow f_\textrm with maximum value. Note that several maximum flows may exist, and if arbitrary real (or even arbitrary rational) values of flow are permitted (instead of just integers), there is either exactly one maximum flow, or infinitely many, since there are infinitely many linear combinations of the base maximum flows. In other words, if we send x units of flow on edge u in one maximum flow, and y > x units of flow on u in another maximum flow, then for each \Delta \in
, y-x The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
/math> we can send x+\Delta units on u and route the flow on remaining edges accordingly, to obtain another maximum flow. If flow values can be any real or rational numbers, then there are infinitely many such \Delta values for each pair x, y.


Algorithms

The following table lists algorithms for solving the maximum flow problem. For additional algorithms, see .


Integral flow theorem

The integral flow theorem states that : If each edge in a flow network has integral capacity, then there exists an integral maximal flow. The claim is not only that the value of the flow is an integer, which follows directly from the
max-flow min-cut theorem In computer science and optimization theory, the max-flow min-cut theorem states that in a flow network, the maximum amount of flow passing from the ''source'' to the ''sink'' is equal to the total weight of the edges in a minimum cut, i.e., the ...
, but that the flow on ''every edge'' is integral. This is crucial for many
combinatorial Combinatorics is an area of mathematics primarily concerned with counting, both as a means and an end in obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many app ...
applications (see below), where the flow across an edge may encode whether the item corresponding to that edge is to be included in the set sought or not.


Application


Multi-source multi-sink maximum flow problem

Given a network N = (V, E) with a set of sources S = \ and a set of sinks T = \ instead of only one source and one sink, we are to find the maximum flow across N. We can transform the multi-source multi-sink problem into a maximum flow problem by adding a ''consolidated source'' connecting to each vertex in S and a ''consolidated sink ''connected by each vertex in T (also known as ''supersource'' and ''supersink'') with infinite capacity on each edge (See Fig. 4.1.1.).


Maximum cardinality bipartite matching

Given a
bipartite graph In the mathematical field of graph theory, a bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V, that is every edge connects a vertex in U to one in V. Vertex sets U and V are ...
G = (X \cup Y, E), we are to find a
maximum cardinality matching Maximum cardinality matching is a fundamental problem in graph theory. We are given a graph , and the goal is to find a matching containing as many edges as possible; that is, a maximum cardinality subset of the edges such that each vertex is ad ...
in G, that is a matching that contains the largest possible number of edges. This problem can be transformed into a maximum flow problem by constructing a network N = (X \cup Y \cup \, E'), where # E' contains the edges in G directed from X to Y. # (s,x) \in E' for each x \in X and (y,t) \in E' for each y \in Y. # c(e) = 1 for each e \in E' (See Fig. 4.3.1). Then the value of the maximum flow in N is equal to the size of the maximum matching in G, and a maximum cardinality matching can be found by taking those edges that have flow 1 in an integral max-flow.


Minimum path cover in directed acyclic graph

Given a
directed acyclic graph In mathematics, particularly graph theory, and computer science, a directed acyclic graph (DAG) is a directed graph with no directed cycles. That is, it consists of vertices and edges (also called ''arcs''), with each edge directed from one ve ...
G = (V, E), we are to find the minimum number of vertex-disjoint paths to cover each vertex in V. We can construct a bipartite graph G' = (V_\textrm \cup V_\textrm, E') from G, where # V_\textrm = \ # V_\textrm = \ # E' = \. Then it can be shown that G' has a matching M of size m if and only if G has a vertex-disjoint path cover C containing m edges and n-m paths, where n is the number of vertices in G. Therefore, the problem can be solved by finding the maximum cardinality matching in G' instead. Assume we have found a matching M of G', and constructed the cover C from it. Intuitively, if two vertices u_\mathrm, v_\mathrm are matched in M, then the edge (u, v) is contained in C. Clearly the number of edges in C is m. To see that C is vertex-disjoint, consider the following: # Each vertex v_\textrm in G' can either be ''non-matched'' in M, in which case there are no edges leaving v in C; or it can be ''matched'', in which case there is exactly one edge leaving v in C. In either case, no more than one edge leaves any vertex v in C. # Similarly for each vertex v_\textrm in G' – if it is matched, there is a single incoming edge into v in C; otherwise v has no incoming edges in C. Thus no vertex has two incoming or two outgoing edges in C, which means all paths in C are vertex-disjoint. To show that the cover C has size n-m, we start with an empty cover and build it incrementally. To add a vertex u to the cover, we can either add it to an existing path, or create a new path of length zero starting at that vertex. The former case is applicable whenever either (u,v) \in E and some path in the cover starts at v, or (v,u) \in E and some path ends at v. The latter case is always applicable. In the former case, the total number of edges in the cover is increased by 1 and the number of paths stays the same; in the latter case the number of paths is increased and the number of edges stays the same. It is now clear that after covering all n vertices, the sum of the number of paths and edges in the cover is n. Therefore, if the number of edges in the cover is m, the number of paths is n-m.


Maximum flow with vertex capacities

Let N = (V, E) be a network. Suppose there is capacity at each node in addition to edge capacity, that is, a mapping c: V\to \R^+, such that the flow f has to satisfy not only the capacity constraint and the conservation of flows, but also the vertex capacity constraint : \sum_ f_ \le c(v) \qquad \forall v \in V \backslash \. In other words, the amount of flow passing through a vertex cannot exceed its capacity. To find the maximum flow across N, we can transform the problem into the maximum flow problem in the original sense by expanding N. First, each v\in V is replaced by v_ and v_, where v_ is connected by edges going into v and v_ is connected to edges coming out from v, then assign capacity c(v) to the edge connecting v_ and v_ (see Fig. 4.4.1). In this expanded network, the vertex capacity constraint is removed and therefore the problem can be treated as the original maximum flow problem.


Maximum number of paths from s to t

Given a directed graph G = (V, E) and two vertices s and t, we are to find the maximum number of paths from s to t. This problem has several variants: 1. The paths must be edge-disjoint. This problem can be transformed to a maximum flow problem by constructing a network N = (V, E) from G, with s and t being the source and the sink of N respectively, and assigning each edge a capacity of 1. In this network, the maximum flow is k iff there are k edge-disjoint paths. 2. The paths must be independent, i.e., vertex-disjoint (except for s and t). We can construct a network N = (V, E) from G with vertex capacities, where the capacities of all vertices and all edges are 1. Then the value of the maximum flow is equal to the maximum number of independent paths from s to t. 3. In addition to the paths being edge-disjoint and/or vertex disjoint, the paths also have a length constraint: we count only paths whose length is exactly k, or at most k. Most variants of this problem are NP-complete, except for small values of k.


Closure problem

A closure of a directed graph is a set of vertices ''C'', such that no edges leave ''C''. The closure problem is the task of finding the maximum-weight or minimum-weight closure in a vertex-weighted directed graph. It may be solved in polynomial time using a reduction to the maximum flow problem.


Real world applications


Baseball elimination

In the
baseball Baseball is a bat-and-ball sport played between two teams of nine players each, taking turns batting and fielding. The game occurs over the course of several plays, with each play generally beginning when a player on the fielding tea ...
elimination problem there are ''n'' teams competing in a league. At a specific stage of the league season, ''w''''i'' is the number of wins and ''r''''i'' is the number of games left to play for team ''i'' and ''r''ij is the number of games left against team ''j''. A team is eliminated if it has no chance to finish the season in the first place. The task of the baseball elimination problem is to determine which teams are eliminated at each point during the season. Schwartz proposed a method which reduces this problem to maximum network flow. In this method a network is created to determine whether team ''k'' is eliminated. Let ''G'' = (''V'', ''E'') be a network with being the source and the sink respectively. One adds a game node''ij'' – which represents the number of plays between these two teams. We also add a team node for each team and connect each game node with ''i'' < ''j'' to ''V'', and connects each of them from ''s'' by an edge with capacity ''r''''ij'' – which represents the number of plays between these two teams. We also add a team node for each team and connect each game node with two team nodes ''i'' and ''j'' to ensure one of them wins. One does not need to restrict the flow value on these edges. Finally, edges are made from team node ''i'' to the sink node ''t'' and the capacity of is set to prevent team ''i'' from winning more than . Let ''S'' be the set of all teams participating in the league and let :r(S - \) = \sum_ r_. In this method it is claimed team ''k'' is not eliminated if and only if a flow value of size ''r''(''S'' − ) exists in network ''G''. In the mentioned article it is proved that this flow value is the maximum flow value from ''s'' to ''t''.


Airline scheduling

In the airline industry a major problem is the scheduling of the flight crews. The airline scheduling problem can be considered as an application of extended maximum network flow. The input of this problem is a set of flights ''F'' which contains the information about where and when each flight departs and arrives. In one version of airline scheduling the goal is to produce a feasible schedule with at most ''k'' crews. To solve this problem one uses a variation of the
circulation problem The circulation problem and its variants are a generalisation of network flow problems, with the added constraint of a lower bound on edge flows, and with flow conservation also being required for the source and sink (i.e. there are no special node ...
called bounded circulation which is the generalization of network flow problems, with the added constraint of a lower bound on edge flows. Let ''G'' = (''V'', ''E'') be a network with as the source and the sink nodes. For the source and destination of every flight ''i'', one adds two nodes to ''V'', node ''s''''i'' as the source and node ''d''''i'' as the destination node of flight ''i''. One also adds the following edges to ''E'': # An edge with capacity
, 1 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
between ''s'' and each ''s''''i''. # An edge with capacity
, 1 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
between each ''d''''i'' and ''t''. # An edge with capacity
, 1 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
between each pair of ''s''''i'' and ''d''''i''. # An edge with capacity
, 1 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
between each ''d''''i'' and ''s''''j'', if source ''s''''j'' is reachable with a reasonable amount of time and cost from the destination of flight ''i''. # An edge with capacity ,_∞.html"_;"title="∞.html"_;"title=",_∞">,_∞">∞.html"_;"title=",_∞">,_∞between_''s''_and_''t''. In_the_mentioned_method,_it_is_claimed_and_proved_that_finding_a_flow_value_of_''k''_in_''G''_between_''s''_and_''t''_is_equal_to_finding_a_feasible_schedule_for_flight_set_''F''_with_at_most_''k''_crews.
Another_version_of_airline_scheduling_is_finding_the_minimum_needed_crews_to_perform_all_the_flights._To_find_an_answer_to_this_problem,_a_bipartite_graph__is_created_where_each_flight_has_a_copy_in_set_''A''_and_set_''B''._If_the_same_plane_can_perform_flight_''j''_after_flight_''i'',__is_connected_to_._A_matching_in__induces_a_schedule_for_''F''_and_obviously_maximum_bipartite_matching_in_this_graph_produces_an_airline_schedule_with_minimum_number_of_crews._As_it_is_mentioned_in_the_Application_part_of_this_article,_the_maximum_cardinality_bipartite_matching_is_an_application_of_maximum_flow_problem.


_Circulation–demand_problem

There_are_some_factories_that_produce_goods_and_some_villages_where_the_goods_have_to_be_delivered._They_are_connected_by_a_networks_of_roads_with_each_road_having_a_capacity__for_maximum_goods_that_can_flow_through_it._The_problem_is_to_find_if_there_is_a_circulation_that_satisfies_the_demand. This_problem_can_be_transformed_into_a_maximum-flow_problem. #_Add_a_source_node__and_add_edges_from_it_to_every_factory_node__with_capacity__where__is_the_production_rate_of_factory_. #_Add_a_sink_node__and_add_edges_from_all_villages__to__with_capacity__where__is_the_demand_rate_of_village_. Let_''G''_=_(''V'',_''E'')_be_this_new_network._There_exists_a_circulation_that_satisfies_the_demand_if_and_only_if_: :___=_\sum__d_i_. If_there_exists_a_circulation,_looking_at_the_max-flow_solution_would_give_the_answer_as_to_how_much_goods_have_to_be_sent_on_a_particular_road_for_satisfying_the_demands. The_problem_can_be_extended_by_adding_a_lower_bound_on_the_flow_on_some_edges.


__Image_segmentation_

In_their_book,_Kleinberg_and_Tardos_present_an_algorithm_for_image_segmentation.html" ;"title="∞">,_∞.html" ;"title="∞.html" ;"title=", ∞">, ∞">∞.html" ;"title=", ∞">, ∞between ''s'' and ''t''. In the mentioned method, it is claimed and proved that finding a flow value of ''k'' in ''G'' between ''s'' and ''t'' is equal to finding a feasible schedule for flight set ''F'' with at most ''k'' crews. Another version of airline scheduling is finding the minimum needed crews to perform all the flights. To find an answer to this problem, a bipartite graph is created where each flight has a copy in set ''A'' and set ''B''. If the same plane can perform flight ''j'' after flight ''i'', is connected to . A matching in induces a schedule for ''F'' and obviously maximum bipartite matching in this graph produces an airline schedule with minimum number of crews. As it is mentioned in the Application part of this article, the maximum cardinality bipartite matching is an application of maximum flow problem.


Circulation–demand problem

There are some factories that produce goods and some villages where the goods have to be delivered. They are connected by a networks of roads with each road having a capacity for maximum goods that can flow through it. The problem is to find if there is a circulation that satisfies the demand. This problem can be transformed into a maximum-flow problem. # Add a source node and add edges from it to every factory node with capacity where is the production rate of factory . # Add a sink node and add edges from all villages to with capacity where is the demand rate of village . Let ''G'' = (''V'', ''E'') be this new network. There exists a circulation that satisfies the demand if and only if : : = \sum_ d_i . If there exists a circulation, looking at the max-flow solution would give the answer as to how much goods have to be sent on a particular road for satisfying the demands. The problem can be extended by adding a lower bound on the flow on some edges.


Image segmentation

In their book, Kleinberg and Tardos present an algorithm for image segmentation">segmenting an image. They present an algorithm to find the background and the foreground in an image. More precisely, the algorithm takes a bitmap as an input modelled as follows: ''ai'' ≥ 0 is the likelihood that pixel ''i'' belongs to the foreground, ''bi'' ≥ 0 in the likelihood that pixel ''i'' belongs to the background, and ''pij'' is the penalty if two adjacent pixels ''i'' and ''j'' are placed one in the foreground and the other in the background. The goal is to find a partition (''A'', ''B'') of the set of pixels that maximize the following quantity :q(A, B) = \sum_ a_i + \sum_ b_i - \sum_ p_, Indeed, for pixels in ''A'' (considered as the foreground), we gain ''ai''; for all pixels in ''B'' (considered as the background), we gain ''bi''. On the border, between two adjacent pixels ''i'' and ''j'', we loose ''pij''. It is equivalent to minimize the quantity :q'(A, B) = \sum_ b_i + \sum_ a_i + \sum_ p_ because :q(A, B) = \sum_ a_i + \sum_ b_i - q'(A, B). We now construct the network whose nodes are the pixel, plus a source and a sink, see Figure on the right. We connect the source to pixel ''i'' by an edge of weight ''ai''. We connect the pixel ''i'' to the sink by an edge of weight ''bi''. We connect pixel ''i'' to pixel ''j'' with weight ''pij''. Now, it remains to compute a minimum cut in that network (or equivalently a maximum flow). The last figure shows a minimum cut.


Extensions

1. In the minimum-cost flow problem, each edge (''u'',v) also has a cost-coefficient ''auv'' in addition to its capacity. If the flow through the edge is ''fuv'', then the total cost is ''auvfuv.'' It is required to find a flow of a given size ''d'', with the smallest cost. In most variants, the cost-coefficients may be either positive or negative. There are various polynomial-time algorithms for this problem. 2. The maximum-flow problem can be augmented by disjunctive constraints: a ''negative disjunctive constraint'' says that a certain pair of edges cannot simultaneously have a nonzero flow; a ''positive disjunctive constraints'' says that, in a certain pair of edges, at least one must have a nonzero flow. With negative constraints, the problem becomes strongly NP-hard even for simple networks. With positive constraints, the problem is polynomial if fractional flows are allowed, but may be strongly NP-hard when the flows must be integral.


References


Further reading

* * * {{DEFAULTSORT:Maximum Flow Problem Network flow problem Computational problems in graph theory